home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-14 | 1016 b | 53 lines | [TEXT/KAHL] |
- // Simple framework for Macintosh sample code
- //
- // Nick Thompson, DEVSUPPORT
- //
- // This file contains the trap detection related code code for the framework.
- //
- // 9/16/94 nick first cut
- //
- // Copyright: © 1992-4 by Apple Computer, Inc.
-
-
- #include <Types.h>
- #include <Traps.h>
- #include <OSUtils.h>
- #include <GestaltEqu.h>
-
- #include "MyTraps.h"
-
- short NumToolboxTraps(void);
- TrapType GetTrapType(short theTrap);
-
- short NumToolboxTraps(void)
- {
- if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E,ToolTrap))
- return 0x0200;
- else
- return 0x0400;
- }
-
- TrapType GetTrapType(short theTrap)
- {
- if ((theTrap & 0x0800) > 0)
- return ToolTrap;
- else
- return OSTrap;
- }
-
- Boolean TrapAvailable(short theTrap)
- {
- TrapType tType;
- Boolean isAvail;
-
- tType = GetTrapType(theTrap);
- if (tType == ToolTrap)
- {
- theTrap &= 0x07FF;
- if (theTrap >= NumToolboxTraps())
- theTrap = _Unimplemented;
- }
-
- isAvail = NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap);
- return isAvail;
- }